<template>
	<view class="funds-page">
		<slw-loading :loading="isLoading"/>
		<view class="funds-scroll">
			<view class="funds-list">
				<view v-for="(item, key) in dataList" :key="key" class="funds-item">
					<view class="funds-box">
						<view class="funds-name">{{item.title}}</view>
						<view class="funds-value">{{item.rander && item.rander(dataInfo)}}</view>
						<!-- <view class="funds-value">0</view> -->
					</view>
					<view class="h-line"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	
	// ///经纪公司代码
	// String BrokerID;
	// ///投资者帐号
	// String AccountID;
	// ///上次质押金额
	// double PreMortgage;
	// ///上次信用额度
	// double PreCredit;
	// ///上次存款额
	// double PreDeposit;
	// ///上次结算准备金
	// double PreBalance;
	// ///上次占用的保证金
	// double PreMargin;
	// ///利息基数
	// double InterestBase;
	// ///利息收入
	// double Interest;
	// ///入金金额
	// double Deposit;
	// ///出金金额
	// double Withdraw;
	// ///冻结的保证金
	// double FrozenMargin;
	// ///冻结的资金
	// double FrozenCash;
	// ///冻结的手续费
	// double FrozenCommission;
	// ///当前保证金总额
	// double CurrMargin;
	// ///资金差额
	// double CashIn;
	// ///手续费
	// double Commission;
	// ///平仓盈亏
	// double CloseProfit;
	// ///持仓盈亏
	// double PositionProfit;
	// ///期货结算准备金
	// double Balance;
	// ///可用资金
	// double Available;
	// ///可取资金
	// double WithdrawQuota;
	// ///基本准备金
	// double Reserve;
	// ///交易日
	// String TradingDay;
	// ///结算编号
	// int SettlementID;
	// ///信用额度
	// double Credit;
	// ///质押金额
	// double Mortgage;
	// ///交易所保证金
	// double ExchangeMargin;
	// ///投资者交割保证金
	// double DeliveryMargin;
	// ///交易所交割保证金
	// double ExchangeDeliveryMargin;
	// ///保底期货结算准备金
	// double ReserveBalance;
	// ///币种代码
	// String CurrencyID;
	// ///上次货币质入金额
	// double PreFundMortgageIn;
	// ///上次货币质出金额
	// double PreFundMortgageOut;
	// ///货币质入金额
	// double FundMortgageIn;
	// ///货币质出金额
	// double FundMortgageOut;
	// ///货币质押余额
	// double FundMortgageAvailable;
	// ///可质押货币金额
	// double MortgageableFund;
	// ///特殊产品占用保证金
	// double SpecProductMargin;
	// ///特殊产品冻结保证金
	// double SpecProductFrozenMargin;
	// ///特殊产品手续费
	// double SpecProductCommission;
	// ///特殊产品冻结手续费
	// double SpecProductFrozenCommission;
	// ///特殊产品持仓盈亏
	// double SpecProductPositionProfit;
	// ///特殊产品平仓盈亏
	// double SpecProductCloseProfit;
	// ///根据持仓盈亏算法计算的特殊产品持仓盈亏
	// double SpecProductPositionProfitByAlg;
	// ///特殊产品交易所保证金
	// double SpecProductExchangeMargin;
	// ///业务类型
	// char BizType;
	// ///延时换汇冻结金额
	// double FrozenSwap;
	// ///剩余换汇额度
	// double RemainSwap;
	
	import {reqQrySecAgentTradingAccount} from '@/api/trader.js'
	import {formatMoney} from '@/utils/index.js'
	import SlwLoading from '@/components/slw-ui/loading/index.vue'
	
	export default {
		components: {SlwLoading},
		data() {
			return {
				isLoading: true,
				dataList: [
					{title: '日期'},
					{title: '币种'},
					{title: '期初权益'},
					{title: '当前权益'},
					{title: '可用资金', rander: info => formatMoney(info.Available)},
					{title: '可取资金', rander: info => formatMoney(info.WithdrawQuota)},
					{title: '风险度'},
					{title: '保证金', rander: info => info.ExchangeMargin},
					{title: '挂单冻结保证金', rander: info => info.DeliveryMargin},
					{title: '挂单冻结资金', rander: info => info.ExchangeDeliveryMargin},
					{title: '持仓盈亏', rander: info => info.SpecProductPositionProfit},
					{title: '平仓盈亏', rander: info => info.SpecProductCloseProfit},
					{title: '手续费', rander: info => info.SpecProductCommission},
					{title: '挂单手续费'},
					{title: '入金金额'},
				],
				dataInfo: {
					Available: 100000,
					WithdrawQuota: 10000
				}
			}
		},
		onShow() {
			this.getInfo()
		},
		// //	下拉刷新
		// onPullDownRefresh() {
		// 	setTimeout(() => {
		// 		uni.stopPullDownRefresh()
		// 	}, 2000)
		// },
		methods: {
			//	获取信息
			getInfo() {
				reqQrySecAgentTradingAccount().then(res => {
					this.isLoading  = false
					this.dataInfo = res.data
				}).catch(err => {
					this.isLoading  = false
					uni.showToast({icon: 'none', title: err.message})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.funds-page{
		min-height: 100vh;
		padding: 0 30rpx;
		background: #fff;
		
		.funds-list{
			.funds-item{
				&:last-child{
					.h-line{display: none;}
				}
			}
			.funds-box{
				height: 90rpx;
				display: flex;
				font-size: 32rpx;
				align-items: center;
				justify-content: space-between;
				.funds-name{
					width: 250rpx;
				}
			}
		}
	}
</style>
